const QQMapWX = require("../lib/qqmap-wx-jssdk.min.js");
var qqmapsdk;
class userFactory {
	getUserLocation() {
		qqmapsdk = new QQMapWX({
			key: 'LWFBZ-RH6W6-GIVSQ-M7VID-625VK-LXBGK'
		});

		uni.getLocation({
			type: 'wgs84',
			success: function(res) {
				console.log('当前位置的纬度：' + res.latitude);
				console.log('当前位置的经度：' + res.longitude);
				qqmapsdk.reverseGeocoder({
					location: {
						latitude: res.latitude,
						longitude: res.longitude
					},
					coord_type: 1,
					get_poi: 1,
					success: function(res, data) {
						console.log(data);
					},
					fail: function(res) {
						console.log(res);
					},
				});
			}
		});
	}

}

module.exports = new userFactory();
